/**
 * @file   MiraPlacement2D.h
 * @author Josep Sabater (jsabaterm@el.ub.edu)
 * @date   October, 2015
 * @version 1.0.0
 * @ingroup MiraGeometryLib
 * @brief  Struct for a given 2D object placement
 *
 * Contains the placement (position + orientation)
 */
#ifndef MIRA_PLACEMENT_2D_H
#define MIRA_PLACEMENT_2D_H

// Add only forward declarations for ostream
#include <iosfwd>

#include "MiraVector2D.h"
#include "MiraTypes.h"

namespace MiraGeometryLib{
    /**
    * @struct Placement2D
    * @brief Contains the placement (position + orientation)
    */
    struct Placement2D{
    public:
        
        //! Container <Vector> of Placement2D
        typedef std::vector<MiraGeometryLib::Placement2D> Place2DCont_t;
        
        // ! A Matrix of Placement2D
        typedef std::vector<Place2DCont_t> Place2DMatrix_t;
        
        /**
         * @brief Constructor for struct 2D Placement
         * @details This is a constructor to use for this struct.
         * @param x a double containing the position of an object in axis X 
         * according to a particular World Frame.
         * @param y a double containing the position of an object in axis Y 
         * according to a particular World Frame.
         * @param orient orientation of the joint (axis Z) in radians according to the World Frame.
         */
        Placement2D(const double& x, const double& y, const double& orientation) : pos(Vector2D(x, y)),
            orient(orientation){};

        Placement2D(const Vector2D& position, const double& orientation)
            : pos(position),
            orient(orientation){};

        Placement2D(const double& orientation) : pos( Vector2D(0,0) ), orient(orientation) {};
        Placement2D() : pos( Vector2D(0,0) ), orient(0) {};
        
        static Place2DCont_t fromDouble(const MiraUtilUBLib::DoubleCont_t &dCont);

        friend std::ostream& operator << (std::ostream& os, const Placement2D& place);
        
        bool operator == (const Placement2D& place) const;
        bool operator != (const Placement2D& place) const;

        Vector2D pos;
        double orient;
        };
}

#endif
